﻿using LiveFrameworkExplorer.Plugins.VSSettings;

namespace LiveFrameworkExplorer.Plugins
{
    public class VSSettingsImportExportPlugin : IPlugin, IPluginBar
    {
        private ILFEBase _lfeBase;

        #region IPlugin Members

        public void Init(ILFEBase lfeBase)
        {
            _lfeBase = lfeBase;
        }

        public string GetPluginLabel()
        {
            return "Import/Export VS Settings";
        }

        public System.Drawing.Image GetPluginImage()
        {
            return LiveFrameworkExplorer.Properties.Resources.settings;
        }

        public void OpenPlugin()
        {
            object ucImpExp = null;
            var vsWin = _lfeBase.CreateWindowToolbox(this, typeof(ucImportExportVSSettings).FullName,
                "Import/Export VS Settings", "{5FC0BC0C-03A1-4454-AC4C-77ECEEC93B8A}", ref ucImpExp);
            (ucImpExp as ucImportExportVSSettings).Init(_lfeBase);
            vsWin.IsFloating = true;
            vsWin.Linkable = false;
            vsWin.Visible = true;
            vsWin.Height = 163;
            vsWin.Width = 537;
        }

        public PluginBarStatus QueryStatus(LFEState state)
        {
            switch (state)
            {
                case LFEState.None:
                    return PluginBarStatus.Invisble;
                case LFEState.Local:
                case LFEState.Mesh:
                    return PluginBarStatus.Enable;
                default:
                    return PluginBarStatus.Disable;
            }
        }

        #endregion
    }
}
